#!/bin/sh

PREFIX=$PWD/../jthread-android-install
NDK=/home/chenc/workspace/Android/Sdk/ndk-bundle 
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/ 
PLATFORM=$NDK/platforms/android-8/arch-arm/ 
SOURCES=$NDK/sources/cxx-stl/gnu-libstdc++/4.8/
CC=$PREBUILT/bin/arm-linux-androideabi-gcc 
CXX=$PREBUILT/bin/arm-linux-androideabi-g++ 
LDFLAGS="--sysroot=$PLATFORM -L$SOURCES/libs/armeabi/ -lgnustl_shared -Wl,-E" 
CFLAGS="-I$PLATFORM/usr/include -fPIC -rdynamic" 
CXXFLAGS=$CFLAGS 
LIBS="-Wl,-Bstatic   -lm  -Wl,-Bdynamic" 

CC=$CC CXX=$CXX LDFLAGS=$LDFLAGS CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS LIBS=$LIBS  cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_INSTALL_PREFIX=$PREFIX -DTHREADS_PTHREAD_ARG=0 -DJTHREAD_COMPILE_STATIC=ON .
